# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shutil
from cerbero.utils import shell

class Recipe(recipe.Recipe):
    name = 'libtool'
    version = '2.4.6'
    licenses = [License.GPLv2]
    stype = SourceType.TARBALL
    url = 'http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz'
    deps = ['m4']
    patches = ['libtool/0001-Add-support-for-weak_framework-linking-on-Darwin.patch']

    files_bin = ['bin/libtool', 'bin/libtoolize']
    files_libs = ['libltdl']
    files_share = ['share/libtool']
    files_aclocal = [
        'share/aclocal/argz.m4',
        'share/aclocal/libtool.m4',
        'share/aclocal/ltdl.m4',
        'share/aclocal/ltoptions.m4',
        'share/aclocal/ltsugar.m4',
        'share/aclocal/ltversion.m4',
        'share/aclocal/lt~obsolete.m4']

    def extract(self):
        if os.path.exists(self.build_dir):
            shutil.rmtree(self.build_dir)
        super(recipe.Recipe, self).extract()

    def configure(self):
        shell.touch(os.path.join(self.build_dir, 'doc', 'libtool.1'))
        shell.touch(os.path.join(self.build_dir, 'doc', 'libtoolize.1'))
        super(recipe.Recipe, self).configure()

